package com.gopay.solution.manager.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.gopay.common.cache.client.RedisClient;
import com.gopay.common.cache.constants.CacheCleanType;
import com.gopay.common.cache.constants.RedisConstants;
import com.gopay.common.cache.service.CacheCleanService;
import com.gopay.common.cache.vo.CacheClean;
import com.gopay.common.constants.Constants;
import com.gopay.common.util.FastJsonUtil;
import org.apache.commons.lang.StringUtils;
import org.bouncycastle.crypto.RuntimeCryptoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.gopay.common.constants.trans.PayChannel;
import com.gopay.common.constants.solution.SolutionTypeConstant;
import com.gopay.solution.dao.SolutionRuleDtlDAO;
import com.gopay.solution.dao.SsApSolutionRelDAO;
import com.gopay.solution.domain.po.SolutionRuleDtl;
import com.gopay.solution.domain.po.SsApSolutionRel;
import com.gopay.solution.domain.vo.Solution;
import com.gopay.solution.manager.SolutionManager;
import com.gopay.solution.manager.SsApSolutionManager;

/**
 * 账户产品与方案关系
 * @SsApSolutionRelManager.java
 * @author liujy
 * @2013-4-7 下午2:08:39  www.gopay.com.cn Inc.All rights reserved.
 */
@Service("ssApSolutionManager")
public class SsApSolutionManagerImpl implements SsApSolutionManager{
    private  final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 账户产品与方案关系
     */
    @Resource(name = "ssApSolutionRelDAO")
    private SsApSolutionRelDAO ssApSolutionRelDAO;
    
    @Resource(name = "ssTransDtlDAO")
    private SolutionRuleDtlDAO<SolutionRuleDtl, Serializable> ssTransDtlDAO;
    
    @Resource(name = "ssTransFeeDtlDAO")
    private SolutionRuleDtlDAO<SolutionRuleDtl, Serializable> ssTransFeeDtlDAO;
    
    @Resource(name = "ssTransPayChanDtlDAO")
    private SolutionRuleDtlDAO<SolutionRuleDtl, Serializable> ssTransPayChanDtlDAO;
    
    @Resource(name = "ssTransSettleDtlDAO")
    private SolutionRuleDtlDAO<SolutionRuleDtl, Serializable> ssTransSettleDtlDAO;
     
    @Resource(name = "ssAcctGainDtlDAO")
    private SolutionRuleDtlDAO<SolutionRuleDtl, Serializable> ssAcctGainDtlDAO;
    
    @Resource(name = "ssTransSoluManager")
    private SolutionManager ssTransSoluManager;
    
    @Resource(name = "ssTransFeeSoluManager")
    private SolutionManager ssTransFeeSoluManager;
    @Resource(name = "ssTransPayChanSoluManager")
    private SolutionManager ssTransPayChanSoluManager;
    @Resource(name = "ssAcctGainSoluManager")
    private SolutionManager ssAcctGainSoluManager;
    @Resource(name = "ssUIConfigSoluManager")
    private SolutionManager ssUIConfigSoluManager;
    
    @Resource(name = "ssTransLimitConfSoluManager")
    private SolutionManager ssTransLimitConfSoluManager;
    
    @Resource(name="ssGpProdComConfSoluManager")
    private SolutionManager ssGpProdComConfSoluManager;
    
    @Resource(name="ssGpProdRiskFundConfSoluManager")
    private SolutionManager ssGpProdRiskFundConfSoluManager;
 
    @Resource(name = "ssTransProfitSoluManager")
    private SolutionManager ssTransProfitSoluManager;  
    
    @Resource(name = "ssTransSettleSoluManager")
    private SolutionManager ssTransSettleSoluManager;

    @Autowired
    RedisConstants redisConstants;

    @Resource(name="cacheCleanService")
    private CacheCleanService cacheCleanService;

    @Override
    public List<SsApSolutionRel> findAllRelByTrn() {
        String hql = "from SsApSolutionRel where solutionType=:solutionType order by createdTs";
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("solutionType", SolutionTypeConstant.TRANS_TRN);
        // 产寻账户产品与方案关系表(solutionType=TRN)
        List<SsApSolutionRel> ssApSolutionRels = ssApSolutionRelDAO.findByHql(hql, param);
        return ssApSolutionRels;
    }

    @Override
    public SsApSolutionRel findRelByProdCode(String acctProdCode, String solutionType) {
        String hql = "from SsApSolutionRel where prodCode=:acctProdCode and solutionType=:solutionType";
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("acctProdCode", acctProdCode);
        param.put("solutionType", solutionType);
        // 产寻账户产品与方案关系表(solutionType=TRN)
        List<SsApSolutionRel> ssApSolutionRels = ssApSolutionRelDAO.findByHql(hql, param);
        if(ssApSolutionRels == null || ssApSolutionRels.isEmpty()){
            return null;
        }
        return ssApSolutionRels.get(0);
    }
    @Override
    public List<SsApSolutionRel> findRelBySolutionType( String solutionType) {
        String hql = "from SsApSolutionRel where  solutionType=:solutionType";
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("solutionType", solutionType);
        // 产寻账户产品与方案关系表(solutionType=TRN)
        List<SsApSolutionRel> ssApSolutionRels = ssApSolutionRelDAO.findByHql(hql, param);
        if(ssApSolutionRels == null || ssApSolutionRels.isEmpty()){
            return null;
        }
        return ssApSolutionRels;
    }
    
    @Override
    public SsApSolutionRel findRelBySoluIdAndActType(String solutionId,String solutionType) {
        String hql = "from SsApSolutionRel where  solutionType=:solutionType  and solutionId=:solutionId ";
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("solutionType", solutionType);
        param.put("solutionId", Long.valueOf(solutionId));
        // 产寻账户产品与方案关系表(solutionType=TRN)
        List<SsApSolutionRel> ssApSolutionRels = ssApSolutionRelDAO.findByHql(hql, param);
        if(ssApSolutionRels == null || ssApSolutionRels.isEmpty()){
            return null;
        }else{
        	return ssApSolutionRels.get(0);
        }
    }
    @Override
    public List<SolutionRuleDtl> findDtlsByProdCodeAndIntTxnCd(String solutionId, String solutionType){
        
        StringBuilder hql = new StringBuilder(" from ");
        if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            hql.append(" SsTransDtl ");
        }else if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            hql.append(" SsAcctGainDtl ");
        }
        hql.append(" where solutionId=:solutionId");
        
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("solutionId", Long.valueOf(solutionId));

        if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            return ssTransDtlDAO.findByHql(hql.toString(), param);
        }else if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            return ssAcctGainDtlDAO.findByHql(hql.toString(), param);
        }
        return null;
    }
    
    @Override
    public List<SolutionRuleDtl> findDtlsByProdCodeAndIntTxnCd(String solutionId, String gopayIntTxnCd, String solutionType){
        
        StringBuilder hql = new StringBuilder(" from ");
        if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            hql.append(" SsTransFeeDtl ");
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            hql.append(" SsTransPayChanDtl ");
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            hql.append(" SsTransSettleDtl ");
        }
        hql.append(" where solutionId=:solutionId and gopayIntTxnCd=:gopayIntTxnCd ");
        
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("solutionId", Long.valueOf(solutionId));
        param.put("gopayIntTxnCd", gopayIntTxnCd);
        
        if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            return ssTransFeeDtlDAO.findByHql(hql.toString(), param);
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            return ssTransPayChanDtlDAO.findByHql(hql.toString(), param);
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            return ssTransSettleDtlDAO.findByHql(hql.toString(), param);
        }
        return null;
    }
    
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public void deleteRelAndChild(SsApSolutionRel rel, String solutionType){
        // 删除关系表、方案表及所有明细表相关记录
        if (rel != null) {
            if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
                ssAcctGainSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
                ssTransSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
                //update by wangdong 20160906 清理手续费方案的所有缓存
                //cleanProdTfee(rel);
                ssTransFeeSoluManager.delete(rel.getSolutionId());
                cacheCleanService.cleanCache(new CacheClean(CacheCleanType.BETWEEN, redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, solutionType));
            }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
                ssTransPayChanSoluManager.delete(rel.getSolutionId());
                cacheCleanService.cleanCache(new CacheClean(CacheCleanType.BETWEEN, redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, solutionType));
            }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){
                ssUIConfigSoluManager.delete(rel.getSolutionId());
                cacheCleanService.cleanCache(new CacheClean(CacheCleanType.BETWEEN, redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, solutionType));
            }else if(SolutionTypeConstant.CUST_TLCS.equals(solutionType)){
            	ssTransLimitConfSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.GP_COM.equals(solutionType)){
                ssGpProdComConfSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.GP_RISKFUND.equals(solutionType)){
                ssGpProdRiskFundConfSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.TRANS_PROFIT.equals(solutionType)){
                ssTransProfitSoluManager.delete(rel.getSolutionId());
            }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
                ssTransSettleSoluManager.delete(rel.getSolutionId());
            }else{
                throw new RuntimeCryptoException("deleteRelAndChild()不支持此solutionType：" + solutionType);
            }
            ssApSolutionRelDAO.delete(rel);
        }
    }

    /**
     * 清理手续费方案的所有缓存
     * @param rel
     */
    private void cleanProdTfee(SsApSolutionRel rel){
        String keys = redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION+":*:"+SolutionTypeConstant.TRANS_FEE;
        try {
            RedisClient.deleteKeyBetween(redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, SolutionTypeConstant.TRANS_FEE);
            logger.info("第一次清理手续费方案所有缓存的key {}",keys);
            ssTransFeeSoluManager.delete(rel.getSolutionId());
        } finally {
            RedisClient.deleteKeyBetween(redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, SolutionTypeConstant.TRANS_FEE);
            logger.info("第二次清理手续费方案所有缓存的key {}",keys);
        }
    }
    
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public SsApSolutionRel saveRelAndChild(SsApSolutionRel rel, Solution s) {
       
        s = saveApSolitionAndChild(s, rel.getSolutionType());
        
        rel.setSolutionId(s.getMeta().getSolutionId());
        ssApSolutionRelDAO.save(rel);
        
        return rel;
    }
    
    /**
     * 保存关系、方案、明细
     * @param acctProdCode
     * @param gopayIntTxnCd
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public Solution saveApSolitionAndChild(Solution s, String solutionType) {
        if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            ssTransFeeSoluManager.save(s);
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            ssTransPayChanSoluManager.save(s);
        }else if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            ssTransSoluManager.save(s);
        }else if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            ssAcctGainSoluManager.save(s);
        }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){
            ssUIConfigSoluManager.save(s);
        }else if(SolutionTypeConstant.CUST_TLCS.equals(solutionType)){
        	ssTransLimitConfSoluManager.save(s);
        }else if (SolutionTypeConstant.GP_COM.equals(solutionType)){
            ssGpProdComConfSoluManager.save(s);
        }else if (SolutionTypeConstant.GP_RISKFUND.equals(solutionType)){
            ssGpProdRiskFundConfSoluManager.save(s);
        }else if(SolutionTypeConstant.TRANS_PROFIT.equals(solutionType)){
            ssTransProfitSoluManager.save(s);
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            ssTransSettleSoluManager.save(s);
        }else{
            throw new RuntimeCryptoException("saveApSolitionAndChild()不支持此solutionType：" + solutionType);
        }
        return s;
    }
    
    /**
     * 更新方案、明细（非关联交易码）
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public void updateSolutionChild(Solution s, String solutionType) {
        if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            ssTransSoluManager.modify(s);
        }else if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            ssAcctGainSoluManager.modify(s);
        }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){
            ssUIConfigSoluManager.modify(s);
            cacheCleanService.cleanCache(new CacheClean(CacheCleanType.BETWEEN, redisConstants.getRedisEnvironment()+":"+Constants.CACHE_CHANNEL_SOLUTION, solutionType));
        }else if(SolutionTypeConstant.CUST_TLCS.equals(solutionType)){
        	ssTransLimitConfSoluManager.modify(s);
        }else if(SolutionTypeConstant.GP_COM.equals(solutionType)){
            ssGpProdComConfSoluManager.modify(s);
        }else if(SolutionTypeConstant.GP_RISKFUND.equals(solutionType)){
            ssGpProdRiskFundConfSoluManager.modify(s);
        }else{
            throw new RuntimeCryptoException("不支持此solutionType：" + solutionType);
        }
    }
    
    /**
     * 更新方案、明细（关联交易码）
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public void updateSolutionChild(Solution s, String intTxnCd, String solutionType,String prodCode) {
        if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            //清除缓存 add by wangdong
            //ssTransFeeSoluManager.modifyBySeqAndIntTxnCd(s, intTxnCd,solutionType,prodCode);
            cacheCleanService.cleanCache(new CacheClean(FastJsonUtil.getKey(redisConstants.getRedisEnvironment(), Constants.CACHE_CHANNEL_SOLUTION, prodCode, intTxnCd, solutionType)));
            ssTransFeeSoluManager.modifyBySeqAndIntTxnCd(s, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            cacheCleanService.cleanCache(new CacheClean(FastJsonUtil.getKey(redisConstants.getRedisEnvironment(), Constants.CACHE_CHANNEL_SOLUTION, null, intTxnCd, solutionType)));
            ssTransPayChanSoluManager.modifyBySeqAndIntTxnCd(s, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_PROFIT.equals(solutionType)){
            ssTransProfitSoluManager.modifyBySeqAndIntTxnCd(s, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            ssTransSettleSoluManager.modifyBySeqAndIntTxnCd(s, intTxnCd);
        }else{
            throw new RuntimeCryptoException("不支持此solutionType：" + solutionType);
        }
    }
    
    /**
     * 更新方案、明细（非关联交易码）
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public Solution load(long solutionId, String solutionType) {
        Solution s = null;
        if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            s = ssTransSoluManager.load(solutionId);
        }else if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            s = ssAcctGainSoluManager.load(solutionId);
        }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){
            s = ssUIConfigSoluManager.load(solutionId);
        }else if(SolutionTypeConstant.CUST_TLCS.equals(solutionType)){
        	s = ssTransLimitConfSoluManager.load(solutionId);
        }else if(SolutionTypeConstant.GP_COM.equals(solutionType)){
            s =  ssGpProdComConfSoluManager.load(solutionId);
        }else if(SolutionTypeConstant.GP_RISKFUND.equals(solutionType)){
            s =  ssGpProdRiskFundConfSoluManager.load(solutionId);
        }
        return s;
    }
    
    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public Solution load(long solutionId, String intTxnCd, String solutionType) {
        Solution s = null;
        if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            s = ssTransFeeSoluManager.loadBySeqAndIntTxnCd(solutionId, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            s = ssTransPayChanSoluManager.loadBySeqAndIntTxnCd(solutionId, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_PROFIT.equals(solutionType)){
            s = ssTransProfitSoluManager.loadBySeqAndIntTxnCd(solutionId, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            s = ssTransSettleSoluManager.loadBySeqAndIntTxnCd(solutionId, intTxnCd);
        }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){//生产bug6期 新增 lx 2017-7-5 11:08:05
            s = ssUIConfigSoluManager.loadBySeqAndIntTxnCd(solutionId, intTxnCd);
        }
        return s;
    }
    
    /**
     * 特定银行指定付款通道是否使用
     * @param bankCode
     *          银行码
     * @param channel
     *          支付通道：1-B2C，2-B2B，3-B2C&B2B
     * @return
     */
    public boolean isBankChannelUsed(String bankCode, String channel){
        StringBuilder sql = new StringBuilder("select count(*) as usedNum from SS_TRANS_PAY_CHAN_DTL s where ");
        sql.append(" s.OUT_STLM_ID='").append(bankCode).append("'");
        sql.append(" and s.PAY_CHANNEL in ('");
        if(StringUtils.equals("1", channel)){
            // B2C
            sql.append(PayChannel._01.value).append("')");
        }else if(StringUtils.equals("2", channel)){
            // B2B
            sql.append(PayChannel._51.value).append("')");
        }else if(StringUtils.equals("3", channel)){
            // B2B&B2C
            sql.append(PayChannel._01.value).append("','");
            sql.append(PayChannel._51.value).append("')");
        }else if(StringUtils.equals(PayChannel._03.value, channel)){
            // 快捷支付
            sql.append(PayChannel._03.value).append("')");
        }else if(StringUtils.equals(PayChannel._04.value, channel)){
            // 信用卡无卡支付
            sql.append(PayChannel._04.value).append("')");
        }else{
            return false;
        }
       
        int num = ssTransPayChanDtlDAO.findCountBySql(sql.toString());
        return num > 0;
    }

	@Override
	public List<SsApSolutionRel> findAllRelByProdCode(String acctProdCode) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
	public boolean delBySoluIdAndIntTxnCd(Long solutionId,String intTxnCd,String solutionType){
        return delBySoluIdAndIntTxnCd(solutionId,intTxnCd,solutionType,null);
	}

    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class, RuntimeException.class })
    public boolean delBySoluIdAndIntTxnCd(Long solutionId, String intTxnCd, String solutionType, String prodCode) {
        if(SolutionTypeConstant.ACCT_GAIN.equals(solutionType)){
            return ssAcctGainSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.TRANS_TRN.equals(solutionType)){
            return ssTransSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.TRANS_FEE.equals(solutionType)){
            //清除缓存 add by wangdong
            cacheCleanService.cleanCache(new CacheClean(FastJsonUtil.getKey(redisConstants.getRedisEnvironment(), Constants.CACHE_CHANNEL_SOLUTION, prodCode, intTxnCd, solutionType)));
            return ssTransFeeSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
            //return  ssTransFeeSoluManager.delBySoluIdAndIntTxnCd(solutionId, intTxnCd,solutionType,prodCode);
        }else if(SolutionTypeConstant.TRANS_PAYCHAN.equals(solutionType)){
            cacheCleanService.cleanCache(new CacheClean(FastJsonUtil.getKey(redisConstants.getRedisEnvironment(), Constants.CACHE_CHANNEL_SOLUTION, null, intTxnCd, solutionType)));
            return  ssTransPayChanSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.TRANS_UIS.equals(solutionType)){
            cacheCleanService.cleanCache(new CacheClean(FastJsonUtil.getKey(redisConstants.getRedisEnvironment(), Constants.CACHE_CHANNEL_SOLUTION, null, intTxnCd, solutionType)));
            return  ssUIConfigSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.CUST_TLCS.equals(solutionType)){
            return  ssTransLimitConfSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.GP_COM.equals(solutionType)){
            return  ssGpProdComConfSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.GP_RISKFUND.equals(solutionType)){
            return  ssGpProdRiskFundConfSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.TRANS_PROFIT.equals(solutionType)){
            return  ssTransProfitSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else if(SolutionTypeConstant.TRANS_SETTLE.equals(solutionType)){
            return  ssTransSettleSoluManager.delBySoluIdAndIntTxnCd(solutionId,intTxnCd);
        }else{
            throw new RuntimeCryptoException("delBySoluIdAndIntTxnCd()不支持此solutionType：" + solutionType);
        }
    }
}